﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestStudentsAndCources
{
    
    
    /// <summary>
    ///This is a test class for StudentTest and is intended
    ///to contain all StudentTest Unit Tests
    ///</summary>
    [TestClass()]
    public class StudentTest
    {
        [TestMethod()]
        public void StudentConstructorTest()
        {
            string name = "Kamen Ivanov"; // TODO: Initialize to an appropriate value
            int facNumber = 15000; // TODO: Initialize to an appropriate value
            Student target = new Student(name, facNumber);
            Assert.AreEqual("Kamen Ivanov", target.Name);
            Assert.AreEqual(15000, target.FacNumber);
        }

        [TestMethod()]
        public void StudentBaseConstructorTest()
        {
            Student target = new Student();
            Assert.AreEqual("random name", target.Name);
            Assert.AreEqual(55555, target.FacNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof (ArgumentNullException))]
        public void StudentConstructorEmptyNameTest()
        {
            Student target = new Student("",55555);
            Assert.AreEqual("random name", target.Name);
            Assert.AreEqual(55555, target.FacNumber);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentNullException))]
        public void StudentConstructorWrongFacNumberTest()
        {
            Student target = new Student("random name", 15);
            Assert.AreEqual("random name", target.Name);
            Assert.AreEqual(55555, target.FacNumber);
        }

        [TestMethod()]
        public void EqualsTest()
        {
            string name = "some name"; 
            int facNumber = 20000; 
            Student student1 = new Student(name, facNumber);
            Student student2 = new Student(name, facNumber);
            bool actual = student1.Equals(student2);
            bool expected = true;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void EqualsDifferentTest()
        {
            string name = "some name";
            int facNumber = 20000;
            Student student1 = new Student(name, facNumber);
            Student student2 = new Student();
            bool actual = student1.Equals(student2);
            bool expected = false;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]        
        public void EqualsNullTest()
        {
            string name = "some name";
            int facNumber = 20000;
            Student student1 = new Student(name, facNumber);
            Student student2 = null;
            bool actual = student1.Equals(student2);
            bool expected = false;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void GetHashCodeTest()
        {
            string name = "some name";
            int facNumber = 25000;
            Student target = new Student(name, facNumber);
            int expected = 25000; 
            int actual;
            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentOutOfRangeException))]
        public void FacNumberSetTest()
        {           
            Student target = new Student();
            int expected = 15000; 
            int actual;
            target.FacNumber = 15;
            actual = target.FacNumber;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Name
        ///</summary>
        [TestMethod()]
        public void NameTest()
        {
            string name = string.Empty; // TODO: Initialize to an appropriate value
            int facNumber = 0; // TODO: Initialize to an appropriate value
            Student target = new Student(name, facNumber); // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            target.Name = expected;
            actual = target.Name;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
